package com.briup.mt.web.controller;

import com.briup.mt.bean.BaseRole;
import com.briup.mt.bean.BaseUser;
import com.briup.mt.bean.BaseUserRole;
import com.briup.mt.service.IBaseUserRoleService;
import com.briup.mt.utils.ExcelUtils;
import com.briup.mt.utils.Message;
import com.briup.mt.utils.MessageUtil;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.constraints.NotNull;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Layla
 * @version 1.0
 * @date 2020/12/16 11:10
 */
@RestController
@Validated
@RequestMapping("/base_user_role")
public class BaseUserRoleController {
    @Resource
    private IBaseUserRoleService baseUserRoleService;
    @GetMapping("query")
    public Message query(Long userId) {
        List<BaseUserRole> list = baseUserRoleService.query(userId);
        return MessageUtil.success(list);
    }
    @PostMapping("saveOrUpdate")
    public  Message saveOrUpdate(BaseUserRole  base){
        baseUserRoleService.saveOrUpdate(base);
        return MessageUtil.success("操作成功");
    }
    @DeleteMapping("deleteByID")
    @ApiImplicitParams({@ApiImplicitParam(name = "id",value="用户编号",required =true, paramType = "query"),})

    public Message deleteByID(@NotNull long id){
        baseUserRoleService.deleteById(id);
        return MessageUtil.success("操作成功");
    }
}


